home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
tex
/
td187src.lzh
/
MAGICDOS.I
< prev
next >
Wrap
Text File
|
1991-06-08
|
12KB
|
718 lines
(*######################################################################
MAGIC Modula's All purpose GEM Interface Cadre
¯ ¯ ¯ ¯ ¯
########################################################################
GEMDOS Disk Operating System Interface for Modula-2
Implementation für Megamax-Modula-2
########################################################################
V2.00 16.10.90 Peter Hellinger Anpassung an neues MagicSys
V1.04 05.08.90 Peter Hellinger
V1.01 18.06.90 Peter Hellinger Auf Anregung von Th. Tempelmann
wurden die Pterm-Funktionen
verändert.
V1.00 (C) by Peter Hellinger
#######################################################################*)
IMPLEMENTATION MODULE MagicDOS;
(*------------------------------*)
(* MM2-COMPILERSWITCHES *)
(* *)
(*$R- Range-Checks *)
(*$S- Stack-Check *)
(*------------------------------*)
FROM SYSTEM IMPORT ADDRESS, ADR, WORD, ASSEMBLER;
FROM MagicSys IMPORT Nil, Null, Bit0, Bit1, Bit2, Bit3, Bit4, Bit5, Bit6, Bit7,
Bit8, Bit9, Bit10, Bit11, Bit12, Bit13, Bit14, Bit15,
LOC, Byte, ByteSet,
sWORD, sINTEGER, sCARDINAL, sBITSET,
lWORD, lINTEGER, lCARDINAL, lBITSET;
IMPORT MagicSys;
VAR lc: lCARDINAL;
li: lINTEGER;
lb: lBITSET;
i: sINTEGER;
c: sCARDINAL;
s: sBITSET;
a: ADDRESS;
x: sCARDINAL;
PROCEDURE Pterm0;
BEGIN
ASSEMBLER
MOVE.W #0, -(SP)
TRAP #1
END;
END Pterm0;
PROCEDURE Cconin (): lCARDINAL;
BEGIN
ASSEMBLER
MOVE.W #1, -(SP)
TRAP #1
ADDQ.L #2, SP
MOVE.L D0, lc
END;
RETURN lc;
END Cconin;
PROCEDURE Cconout (ch: CHAR);
BEGIN
x:= ORD(ch);
ASSEMBLER
MOVE.W x, -(SP)
MOVE.W #2, -(SP)
TRAP #1
ADDQ.L #4, SP
END;
END Cconout;
PROCEDURE Cauxin (): sCARDINAL;
BEGIN
ASSEMBLER
MOVE.W #3, -(SP)
TRAP #1
ADDQ.L #2, SP
MOVE.W D0, c
END;
RETURN c;
END Cauxin;
PROCEDURE Cauxout (ch: CHAR);
BEGIN
x:= ORD (ch);
ASSEMBLER
MOVE.W x, -(SP)
MOVE.W #4, -(SP)
TRAP #1
ADDQ.L #4, SP
END;
END Cauxout;
PROCEDURE Cprnout (ch: CHAR);
BEGIN
x:= ORD (ch);
ASSEMBLER
MOVE.W x, -(SP)
MOVE.W #5, -(SP)
TRAP #1
ADDQ.L #4, SP
END;
END Cprnout;
PROCEDURE Crawio (ch: CHAR): lCARDINAL;
BEGIN
x:= ORD (ch);
ASSEMBLER
MOVE.W x, -(SP)
MOVE.W #6, -(SP)
TRAP #1
ADDQ.L #4, SP
MOVE.L D0, lc
END;
RETURN lc;
END Crawio;
PROCEDURE Crawin (): lCARDINAL;
BEGIN
ASSEMBLER
MOVE.W #7, -(SP)
TRAP #1
ADDQ.L #2, SP
MOVE.L D0, lc
END;
RETURN lc;
END Crawin;
PROCEDURE Cnecin (): lCARDINAL;
BEGIN
ASSEMBLER
MOVE.W #8, -(SP)
TRAP #1
ADDQ.L #2, SP
MOVE.L D0, lc
END;
RETURN lc;
END Cnecin;
PROCEDURE Cconws (string: ARRAY OF CHAR);
BEGIN
ASSEMBLER
MOVE.L string(A6), -(SP)
MOVE.W #9, -(SP)
TRAP #1
ADDQ.L #6, SP
END;
END Cconws;
PROCEDURE Cconrs (VAR string: ARRAY OF CHAR);
BEGIN
ASSEMBLER
MOVE.L string(A6), -(SP)
MOVE.W #10, -(SP)
TRAP #1
ADDQ.L #6, SP
END;
END Cconrs;
PROCEDURE Cconis (): BOOLEAN;
BEGIN
ASSEMBLER
MOVE.W #11, -(SP)
TRAP #1
ADDQ.L #2, SP
MOVE.W D0, x
END;
RETURN x # 0;
END Cconis;
PROCEDURE Dsetdrv (drive: sCARDINAL; VAR drvmap: lBITSET);
BEGIN
ASSEMBLER
MOVE.W drive(A6), -(SP)
MOVE.W #14, -(SP)
TRAP #1
ADDQ.L #4, SP
MOVE.L D0, lb
END;
drvmap:= lb;
END Dsetdrv;
PROCEDURE Cconos (): BOOLEAN;
BEGIN
ASSEMBLER
MOVE.W #16, -(SP)
TRAP #1
ADDQ.L #2, SP
MOVE.W D0, c
END;
RETURN c # 0;
END Cconos;
PROCEDURE Cprnos (): BOOLEAN;
BEGIN
ASSEMBLER
MOVE.W #17, -(SP)
TRAP #1
ADDQ.L #2, SP
MOVE.W D0, c
END;
RETURN c # 0;
END Cprnos;
PROCEDURE Cauxis (): BOOLEAN;
BEGIN
ASSEMBLER
MOVE.W #18, -(SP)
TRAP #1
ADDQ.L #2, SP
MOVE.W D0, c
END;
RETURN c # 0;
END Cauxis;
PROCEDURE Cauxos (): BOOLEAN;
BEGIN
ASSEMBLER
MOVE.W #19, -(SP)
TRAP #1
ADDQ.L #2, SP
MOVE.W D0, c
END;
RETURN c # 0;
END Cauxos;
PROCEDURE Dgetdrv (): sCARDINAL;
BEGIN
ASSEMBLER
MOVE.W #25, -(SP)
TRAP #1
ADDQ.L #2, SP
MOVE.W D0, c
END;
RETURN c;
END Dgetdrv;
PROCEDURE Fsetdta (dta: ADDRESS);
BEGIN
ASSEMBLER
MOVE.L dta(A6), -(SP)
MOVE.W #26, -(SP)
TRAP #1
ADDQ.L #6, SP
END;
END Fsetdta;
PROCEDURE Super (VAR stack: ADDRESS);
BEGIN
a:= stack;
ASSEMBLER
MOVE.L a, -(SP)
MOVE.W #32, -(SP)
TRAP #1
ADDQ.L #6, SP
MOVE.L D0, a
END;
stack:= a;
END Super;
PROCEDURE Tgetdate (): sCARDINAL;
BEGIN
ASSEMBLER
MOVE.W #42, -(SP)
TRAP #1
ADDQ.L #2, SP
MOVE.W D0, c
END;
RETURN c;
END Tgetdate;
PROCEDURE Tsetdate (date: sCARDINAL);
BEGIN
c:= date;
ASSEMBLER
MOVE.W c, -(SP)
MOVE.W #43, -(SP)
TRAP #1
ADDQ.L #4, SP
END;
END Tsetdate;
PROCEDURE Tgettime (): sCARDINAL;
BEGIN
ASSEMBLER
MOVE.W #44, -(SP)
TRAP #1
ADDQ.L #2, SP
MOVE.W D0, c
END;
RETURN c;
END Tgettime;
PROCEDURE Tsettime (time: sCARDINAL);
BEGIN
c:= time;
ASSEMBLER
MOVE.W c, -(SP)
MOVE.W #45, -(SP)
TRAP #1
ADDQ.L #4, SP
END;
END Tsettime;
PROCEDURE Fgetdta (): ADDRESS;
BEGIN
ASSEMBLER
MOVE.W #47, -(SP)
TRAP #1
ADDQ.L #2, SP
MOVE.L D0, a
END;
RETURN a;
END Fgetdta;
PROCEDURE Sversion (): sCARDINAL;
BEGIN
ASSEMBLER
MOVE.W #48, -(SP)
TRAP #1
ADDQ.L #2, SP
MOVE.W D0, c
END;
RETURN c;
END Sversion;
PROCEDURE Ptermres (keep: lCARDINAL; return: sCARDINAL);
BEGIN
c:= return; lc:= keep;
ASSEMBLER
MOVE.W c, -(SP)
MOVE.L lc, -(SP)
MOVE.W #49, -(SP)
TRAP #1
END;
END Ptermres;
PROCEDURE Dfree (VAR dib: ARRAY OF LOC; drive: sCARDINAL);
BEGIN
c:= drive;
ASSEMBLER
MOVE.W c, -(SP)
MOVE.L dib(A6), -(SP)
MOVE.W #54, -(SP)
TRAP #1
ADDQ.L #8, SP
END;
END Dfree;
PROCEDURE Dcreate (pfad: ARRAY OF CHAR): sINTEGER;
BEGIN
ASSEMBLER
MOVE.L pfad(A6), -(SP)
MOVE.W #57, -(SP)
TRAP #1
ADDQ.L #6, SP
MOVE.W D0, i
END;
RETURN i;
END Dcreate;
PROCEDURE Ddelete (pfad: ARRAY OF CHAR): sINTEGER;
BEGIN
ASSEMBLER
MOVE.L pfad(A6), -(SP)
MOVE.W #58, -(SP)
TRAP #1
ADDQ.L #6, SP
MOVE.W D0, i
END;
RETURN i;
END Ddelete;
PROCEDURE Dsetpath (pfad: ARRAY OF CHAR): sINTEGER;
BEGIN
ASSEMBLER
MOVE.L pfad(A6), -(SP)
MOVE.W #59, -(SP)
TRAP #1
ADDQ.L #6, SP
MOVE.W D0, i
END;
RETURN i;
END Dsetpath;
PROCEDURE Fcreate (name: ARRAY OF CHAR; attr: sBITSET): sINTEGER;
BEGIN
ASSEMBLER
MOVE.W attr(A6), -(SP)
MOVE.L name(A6), -(SP)
MOVE.W #60, -(SP)
TRAP #1
ADDQ.L #8, SP
MOVE.W D0, i
END;
RETURN i;
END Fcreate;
PROCEDURE Fopen (name: ARRAY OF CHAR; mode: sCARDINAL): sINTEGER;
BEGIN
ASSEMBLER
MOVE.W mode(A6), -(SP)
MOVE.L name(A6), -(SP)
MOVE.W #61, -(SP)
TRAP #1
ADDQ.L #8, SP
MOVE.W D0, i
END;
RETURN i;
END Fopen;
PROCEDURE Fclose (handle: sINTEGER): sINTEGER;
BEGIN
ASSEMBLER
MOVE.W handle(A6), -(SP)
MOVE.W #62, -(SP)
TRAP #1
ADDQ.L #4, SP
MOVE.W D0, i
END;
RETURN i;
END Fclose;
PROCEDURE Fread (handle: sINTEGER; VAR count: lCARDINAL; buffer: ADDRESS);
BEGIN
lc:= count;
ASSEMBLER
MOVE.L buffer(A6), -(SP)
MOVE.L lc, -(SP)
MOVE.W handle(A6), -(SP)
MOVE.W #63, -(SP)
TRAP #1
LEA $C(SP), SP
MOVE.L D0, lc
END;
count:= lc;
END